
<template>
  <div>
    <!-- <div class="cen title">{{ dataForm.title }}</div> -->
    
    <div class="mytext">问卷标题：{{ dataForm.title }}</div>
    <div class="mytext">问卷描述：{{ dataForm.text }}</div>
    <div class="mytext">截止时间：{{ $format(dataForm.stopTime) }}</div>
    <!-- <div class="mytext">参与人数：<span style="color:#0095FF">{{ dataForm.read_num }}</span>人</div> -->

    <div :key="item.AID" v-for="(item,ind) in answerlist" >
      <div v-if="item.type!==2" class="ancard">
          <div style="font-weight:bold">{{ind+1}}.{{item.title}}</div>
            <div v-for="(it,index) in item.content" :key="index" class="anmsg">

               <div class="votes" >{{index+1}}.{{ it.name }}</div>
              <div class="votes">{{it.type}}票</div>
          </div>
      </div>
       
       
    </div>
  </div>
</template>
<script>
export default {
  props: {
    data: {
      type: Object,
    },
  },
  data() {
    return {
      dataForm: {
        title: "",
        text: "",
      },
      answers:[],
      answerlist:[]
    };
  },
  methods: {
    //获取选项结果
    getOne(){
      const params = {
        limit: 1,
        page: 1,
        where: {
          status: 1,
          VID: this.dataForm.VID
        },
      };
      this.$api.wxNotic.weixin_vote_one_1(params).then((res) => {
        if (res.code == 0) {
            this.answers = res.answers;
            this.answerlist=res.answers[0].dataForm
        }
      });
    },
  },
  async mounted() {
    this.dataForm = this.data;
    this.dataForm.stopTime = new Date(this.dataForm.stopTime);
    await this.getOne();
  },
};
</script>

<style lang="scss" scoped>
.cen {
  text-align: center;
}
.row {
  // display: flex;
  // flex-direction: row;
  // flex-wrap: wrap;
}
.mr20 {
  margin-right: 20px;
}
.title{
  font-size: 18px;
  font-weight: bold;
}
.mytext{
  margin: 10px 10px 10px 0px;
}
.votes{
  margin: 10px 40px 0 10px;
}
.myvote{
  position: absolute;
  right: 10px;
}
.anmsg{
   display: flex;
   justify-content: space-between;
}
.ancard{
    border: 1px solid #ccc;
    padding: 16px;
    margin-top: 10px;
}
</style>
